public class ThreadDemo2 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(() -> {
            System.out.println("hello t");
        });

        t.start();
        //等待一个线程-join()
        t.join();//在main线程中调用t.join(),让main线程等t线程结束,再往下执行
        System.out.println("hello main");

    }
}
